package com.tansun.easycare.move;

import java.text.DecimalFormat;

import com.tansun.easycare.rule.common.model.BaseModel;

/**
 * xml 规则集 元数据
 *
 * @author WY
 */
public class RuleCollectionVo extends BaseModel {
    /**
     *
     */
    private static final long serialVersionUID = 3935940098105913951L;
    /**
     * genanlruleSet policyRuleset
     */
    private String type;
    private String name;
    /**
     * v0.01
     */
    private String version;
    private String creatorId;
    private String createDate;
    private String updatorId;
    private String updateDate;
    /**
     * 删除：0,正常：1,发布：2
     */
    private String state;
    /**
     * 所有人
     */
    private String owner;
    /**
     * 被授权人：user1;user2;user3;
     */
    private String users;
    /**
     * 加锁人
     */
    private String locker;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(String creatorId) {
        this.creatorId = creatorId;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    public String getUpdatorId() {
        return updatorId;
    }

    public void setUpdatorId(String updatorId) {
        this.updatorId = updatorId;
    }

    public String getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(String updateDate) {
        this.updateDate = updateDate;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getUsers() {
        return users;
    }

    public void setUsers(String users) {
        this.users = users;
    }

    public String getLocker() {
        return locker;
    }

    public void setLocker(String locker) {
        this.locker = locker;
    }

    public String upgradeVersion() {
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        Double v = Double.parseDouble(version);
        v = v + 0.01;
        this.version = decimalFormat.format(v);
        return this.version;
    }

    public String diployVersion() {
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        Double v = Double.parseDouble(version);
        Integer vi = (int) v.doubleValue();
        vi = vi + 1;
        this.version = decimalFormat.format(vi);
        return this.version;
    }

    public static void main(String[] args) {
        RuleCollectionVo rcv = new RuleCollectionVo();
        rcv.setVersion("3.02");
        System.out.println(rcv.upgradeVersion());
        System.out.println(rcv.diployVersion());
    }
}
